<?php
class MaintenanceModel extends BaseModel
{
    /**
     * 获取计划旗下的任务数量
     * @param $pid
     * @return mixed
     */
    public function getPlanCount($pid)
    {
        $map = array();
        $map['pid'] = $pid;
        return $this->where($map)->count();
    }

    /**
     * 获取计划旗下的任务
     * @param $pid
     * @param $limit
     */
    public function getPlanTaskList($pid, $limit)
    {
        //获取任务
        $map = array();
        $map['pid'] = $pid;
        $tasks = $this->where($map)->order('itemid DESC')->limit($limit)->select();
        //获取分配数据
        return $tasks;
    }
}